package com.consult.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.consult.config.dto.AjaxResult;
import com.consult.entity.Duty;
import com.consult.service.IDutyService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 值班
 *
 * @author ${author}
 * @since 2021-06-22
 */
@RestController
@RequestMapping("/duty")
public class DutyController {

    @Resource
    private IDutyService dutyService;

    @PostMapping("/add")
    public AjaxResult addDuty(@RequestBody Duty duty) {
        dutyService.save(duty);
        return AjaxResult.success();
    }

    @PostMapping("/update")
    public AjaxResult updateDuty(@RequestBody Duty duty) {
        dutyService.updateById(duty);
        return AjaxResult.success();
    }

    @PostMapping("/page")
    public AjaxResult getDutyPage(@RequestBody Page<Duty> page) {
        page = dutyService.getDutyPage(page);
        return AjaxResult.success(page);
    }

}

